home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1998 July / EnigmA AMIGA RUN 29 (1998)(G.R. Edizioni)(IT)[!][issue 1998-07 & 08].iso / earkit / socket / miami3 / miamisdk / netinclude / bsdsocket / socketbasetags.h < prev   
C/C++ Source or Header  |  1998-05-24  |  4KB  |  133 lines

  1. #ifndef _BSDSOCKET_SOCKETBASETAGS_H_
  2. #define _BSDSOCKET_SOCKETBASETAGS_H_
  3. /*
  4.  *
  5.  * please see the file COPYRIGHT for information on copyright
  6.  * and distribution
  7.  *      
  8.  */
  9.  
  10. #ifndef UTILITY_TAGITEM_H
  11. #include <utility/tagitem.h>
  12. #endif
  13.  
  14. /*
  15.  * Argument passed by reference or by value (covers bit 15)
  16.  */
  17. #define SBTF_VAL 0x0000
  18. #define SBTF_REF 0x8000
  19.  
  20. /*
  21.  * Code value (covers bits 1-14)
  22.  */
  23. #define SBTB_CODE 1
  24. #define SBTS_CODE 0x3FFF
  25. #define SBTM_CODE(tag) ((((UWORD)(tag))>>SBTB_CODE) & SBTS_CODE)
  26.  
  27. /* 
  28.  * Get/Set (read/write) selection (covers bit 0)
  29.  */
  30. #define SBTF_GET  0x0
  31. #define SBTF_SET  0x1
  32.  
  33. /*
  34.  * These are the macros that should actually be used in the
  35.  * SocketBaseTags() call. Pass one of the SBTC_ values as the
  36.  * "code" parameter here, and pass the argument in ti_Data.
  37.  */
  38. #define SBTM_GETREF(code) \
  39.  (TAG_USER | SBTF_REF | (((code) & SBTS_CODE) << SBTB_CODE))
  40.  
  41. #define SBTM_GETVAL(code) (TAG_USER | (((code) & SBTS_CODE) << SBTB_CODE))
  42.  
  43. #define SBTM_SETREF(code) \
  44.  (TAG_USER | SBTF_REF | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_SET)
  45.  
  46. #define SBTM_SETVAL(code) \
  47.  (TAG_USER | (((code) & SBTS_CODE) << SBTB_CODE) | SBTF_SET)
  48.  
  49. /*
  50.  * Available codes for the above macros.
  51.  */
  52.  
  53. /* masks defining the signals for task notification */
  54. #define SBTC_BREAKMASK      1
  55. #define SBTC_SIGIOMASK      2
  56. #define SBTC_SIGURGMASK     3
  57. #define SBTC_SIGEVENTMASK   4
  58.  
  59. /* current value of the errno and h_errno variables */
  60. #define SBTC_ERRNO          6
  61. #define SBTC_HERRNO         7
  62.  
  63. /* current size of the socket descriptor table */
  64. #define SBTC_DTABLESIZE     8
  65.  
  66. /* callback function to control and intercept the allocation of
  67.  * socket descriptor values
  68.  * 
  69.  * The argument is a pointer to a callback function which is called
  70.  * by the kernel with the following prototype:
  71.  *
  72.  * long fd = fdCallback(long fd, long action);
  73.  *      D0                   D0       D1
  74.  *
  75.  */
  76. #define SBTC_FDCALLBACK     9
  77. /*
  78.  * "action" values:
  79.  */
  80. #define FDCB_FREE  0
  81. #define FDCB_ALLOC 1
  82. #define FDCB_CHECK 2
  83.  
  84. /* control the behavior of syslog() and vsyslog() */
  85. #define SBTC_LOGSTAT        10
  86. #define SBTC_LOGTAGPTR      11
  87. #define SBTC_LOGFACILITY    12
  88. #define SBTC_LOGMASK        13
  89.  
  90. /*
  91.  * The argument for the following tags is an ULONG with the error
  92.  * number (as an input argument, passed to the function). On return
  93.  * the error number has been replaced with a read-only pointer
  94.  * to the corresponding error message.
  95.  *
  96.  * NOTE: error numbers defined in <exec/errors.h>
  97.  * are negative and must be negated (so they become positive)
  98.  * before passing them to SocketBaseTagList().
  99.  */
  100. #define SBTC_ERRNOSTRPTR    14 /* <sys/errno.h> */
  101. #define SBTC_HERRNOSTRPTR   15 /* <netdb.h> */
  102. #define SBTC_IOERRNOSTRPTR  16 /* <exec/errors.h> */
  103. #define SBTC_S2ERRNOSTRPTR  17 /* <devices/sana2.h> */
  104. #define SBTC_S2WERRNOSTRPTR 18 /* <devices/sana2.h> */
  105.  
  106.  
  107. /* link the errno variable in the protocol stack to the errno variable
  108.    in your program */
  109. #define SBTC_ERRNOBYTEPTR   21
  110. #define SBTC_ERRNOWORDPTR   22
  111. #define SBTC_ERRNOLONGPTR   24
  112. /*
  113.  * Macro for generating the errnoptr tag code from a given size.
  114.  * Only 1, 2 & 4 are allowed as 'size' values, corresponding to
  115.  * 'char', 'short', and 'long' with typical compilers.
  116.  * If the 'size' value is illegal, this macro sets the tag to 0,
  117.  * which causes SocketBaseTagList() to fail.
  118.  */
  119. #define SBTC_ERRNOPTR(size)    ((size == sizeof(long)) ? SBTC_ERRNOLONGPTR :\
  120.  ((size == sizeof(short)) ? SBTC_ERRNOWORDPTR :\
  121.  ((size == sizeof(char)) ? SBTC_ERRNOBYTEPTR :\
  122.  0)))
  123.  
  124. /* link the h_errno variable in the stack to the h_errno variable in
  125.    your program */
  126. #define SBTC_HERRNOLONGPTR  25
  127.  
  128. /* pointer to a text string with release information on the
  129.    protocol stack being used (read only!) */
  130. #define SBTC_RELEASESTRPTR  29
  131.  
  132. #endif /* !BSDSOCKET_SOCKETBASETAGS_H */
  133.